﻿<!--
function killErrors() {
return true;
}
window.onerror = killErrors;

function oCopy(str)
{
var clipBoardContent=str;
window.clipboardData.setData("Text",clipBoardContent);
alert("复制成功，您可以粘贴到你的 MSN/QQ/Blog/BBS 上推荐给你的好友");
}

//页头部位搜索分类
var searchid=0;
function searchsort(str,search_id){
  if(search_id!=searchid){
    document.getElementsByName("searchsortdiv")[searchid].className = "fu_bg_1";
    document.getElementsByName("searchsortdiv")[search_id].className = "fu_bg";
    document.searchform.Type.value = str;
	searchid = search_id;
  }
}

//加入收藏
function myAddPanel(title,url,desc)
{
if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function'))
//Gecko
{
window.sidebar.addPanel(title,url,desc);
}
else
//IE
{
window.external.AddFavorite(url,title);
}
}


//图片处理 Begin ===========================================
var flag=false;
function DrawImage(ImgD,w,h){
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0){
  flag=true;
  if(image.width/image.height>= w/h){
    if(image.width>w){
      ImgD.width=w;
      ImgD.height=(image.height*w)/image.width;
    }else{
      ImgD.width=image.width;
      ImgD.height=image.height;
    }
  }else{
    if(image.height>h){
      ImgD.height=h;
      ImgD.width=(image.width*h)/image.height;
    }else{
      ImgD.width=image.width;
      ImgD.height=image.height;
    }
  }
}
}

//改变图片大小
function resizepic(thispic)
{if(thispic.width>500) thispic.width=500;}
//图片处理 End ===========================================

function textLimitCheck(thisArea, maxLength){
  if (thisArea.value.length > maxLength){
    alert('限 '+maxLength + ' 个字符. \r超出的部分将自动去除.');
    thisArea.value = thisArea.value.substring(0, maxLength);
    thisArea.focus();
  }
}

function isNumberString(InString,RefString)
{
if(InString.length==0) return (false);
for (Count=0; Count < InString.length; Count++)  {
	TempChar= InString.substring (Count, Count+1);
	if (RefString.indexOf (TempChar, 0)==1)
	return (false);
}
return (true);
}

//更改字体大小 Begin =============================================
function fontZoomA(){
    document.getElementById('fontzoom').style.fontSize='';
	document.getElementById('fontzoom').style.lineHeight='';
}
function fontZoomB(){
    document.getElementById('fontzoom').style.fontSize='18pt';
	document.getElementById('fontzoom').style.lineHeight='28pt';
}
//更改字体大小 End =============================================

//当前时间
function SiteDate(){
 var enable=0; today=new Date();
   var day; var date;
   var time_start = new Date();
   var clock_start = time_start.getTime();
   if(today.getDay()==0)  day="星期日"
   if(today.getDay()==1)  day="星期一"
   if(today.getDay()==2)  day="星期二"
   if(today.getDay()==3)  day="星期三"
   if(today.getDay()==4)  day="星期四"
   if(today.getDay()==5)  day="星期五"
   if(today.getDay()==6)  day="星期六"
   date=(today.getFullYear())+"年"+(today.getMonth()+1)+"月"+today.getDate()+"日 ";
   document.write(date + day);
}

//密码强度检测 Begin =======================
function CharMode(iN){
	if (iN>=48 && iN <=57) //数字
		return 1;
	if (iN>=65 && iN <=90) //大写字母
		return 2;
	if (iN>=97 && iN <=122) //小写
		return 4;
	else
		return 8; //特殊字符
}

function checkStrong(sPW){
	if (sPW.length<=4)
		return 0;  //密码太短
	Modes=0;
	for (i=0;i<sPW.length;i++){
		Modes|=CharMode(sPW.charCodeAt(i));
	}
	return bitTotal(Modes);
}

function bitTotal(num){
	modes=0;
	for (i=0;i<4;i++){
		if (num & 1) modes++;
		num>>>=1;
	}
	return modes;
}

function pwStrength(pwd){
	O_color="#eeeeee";
	L_color="#FF0000";
	M_color="#FF9900";
	H_color="#33CC00";
	if (pwd==null||pwd==''){
		Lcolor=Mcolor=Hcolor=O_color;
	}
	else{
		S_level=checkStrong(pwd);
		switch(S_level)	 {
			case 0:
			case 1:
				Lcolor=L_color;
				Mcolor=Hcolor=O_color;
				break;
			case 2:
				Lcolor=Mcolor=M_color;
				Hcolor=O_color;
				break;
			default:
				Lcolor=Mcolor=Hcolor=H_color;
				}
	 }
	document.getElementById("strength_L").style.background=Lcolor;
	document.getElementById("strength_M").style.background=Mcolor;
	document.getElementById("strength_H").style.background=Hcolor;
	document.getElementById("strength_L").innerHTML=Text_L;
	document.getElementById("strength_M").innerHTML=Text_M;
	document.getElementById("strength_H").innerHTML=Text_H;
	return;
}
//密码强度检测 End =======================

// 显示无模式对话框
function ShowDialog(url, width, height) {
	var arr = showModalDialog(url, window, "dialogWidth:" + width + "px;dialogHeight:" + height + "px;help:no;scroll:no;status:no");
}

//表单提交 Begin =======================
function Ctlent(){
//ctrl + Enter
if(event.ctrlKey && window.event.keyCode==13){
  if(ClcKcntr()){
    this.document.addform.submit();
  }
}
//ctrl + s
if(event.ctrlKey && window.event.keyCode==83){
  if(ClcKcntr()){
    this.document.addform.submit();
  }
}
}
clckcnt=0;
function ClcKcntr(){
  clckcnt++;
  if(clckcnt > 1){
    alert('请求已经发出，请等待片刻！\n\n'+'不要重复提交，谢谢！');
	return false;
  }
  return true;
}
//表单提交 End =======================

function AddProduct(addKeyword) {
  var revisedTitle ="";
  var currentTitle = document.myform.Product.value;
  var key = 0;
  var sel2=currentTitle.split(',');
  for(var i = 0;i < sel2.length;i ++) {
	if(sel2[i] == addKeyword) {
	   key=1;
	}
  }
  if(key==1){
    for(var i = 0;i < sel2.length;i ++) {
	  if(sel2[i] != addKeyword) {
        if(sel2[i]!=""){
		  if (currentTitle==""){
            revisedTitle = sel2[i];
          }else{
		    if (revisedTitle!=""){
              revisedTitle = revisedTitle+","+sel2[i];
			}else{
              revisedTitle = sel2[i];
			}
          }
		}
	  }
    }
  }else{
    if (currentTitle==""){
       revisedTitle = addKeyword;
    }else{
       revisedTitle = currentTitle+","+addKeyword;
    }
  }
  document.myform.Product.value=revisedTitle;
}

//上传操作 Begin ============================================
//上传完成后返回参数处理
function upcom(Spath,path){
  if(path!=""){
  if(Spath!=""){
      document.myform.SPic.value = Spath;
    }else{
      document.myform.SPic.value = path;
    }
    document.myform.Pic.value = path;
  }
  document.getElementById("up").style.display = "none";
  closeWithIframe();
}
//优惠券上传完成后返回参数处理
function upcou(Spath,path) {
    var sel1 = document.myform.PicList.value;
	if(sel1!=""){
	  sel1 = sel1 +'|'+path;
	}else{
	  sel1 = path;
	}
    document.myform.PicList.value = sel1;
	var sel2=document.myform.Pic;
	sel2.options[sel2.length]=new Option(path,Spath);
	sel2.selectedIndex = sel2.length-1;
	document.getElementById("PicPreview").innerHTML = "<Img src="+Spath+" onload=\'DrawImage(this, 118, 118);\'>";
    document.getElementById("PicUp").style.display='none'
}

function PicReset(str){
  if(str != ""){document.getElementById("PicPreview").innerHTML = "<Img src="+str+" onload=\'DrawImage(this, 118, 118);\'>";}
}
//上传操作 End ============================================

//全角转半角 =====================================
function DBC2SBC(input,str,flag){
var i;
var result='';
for(i=0;i<str.length;i++){
str1=str.charCodeAt(i);
if(str1<125&&!flag)
result+=String.fromCharCode(str.charCodeAt(i));
else
result+=String.fromCharCode(str.charCodeAt(i)-65248);
}
input.value = result;
}

//浮动提示框功能 Begin ========================================
var Obj=''
document.onmouseup=MUp
document.onmousemove=MMove

function MDown(Object){
Obj=Object.id
document.all(Obj).setCapture()
pX=event.x-document.all(Obj).style.pixelLeft;
pY=event.y-document.all(Obj).style.pixelTop;
}

function MMove(){
if(Obj!=''){
  document.all(Obj).style.left=event.x-pX;
  document.all(Obj).style.top=event.y-pY;
  }
}

function MUp(){
if(Obj!=''){
  document.all(Obj).releaseCapture();
  Obj='';
  }
}
document.write('<div id="massage_box" style="display:none">loading...</div>');
document.write('<div id="bgDiv" style="display:none"></div>');
function openWithIframe(tit,url,w,h){
    //屏幕背景变暗
	var sWidth,sHeight;
	sWidth=document.body.clientWidth;
	sHeight=document.body.scrollHeight;
	if(sHeight<window.screen.height){sHeight=window.screen.height;}
	document.getElementById("bgDiv").style.display="";
	document.getElementById("bgDiv").style.position="absolute";
	document.getElementById("bgDiv").style.top="0";
	document.getElementById("bgDiv").style.background="#000000";
	document.getElementById("bgDiv").style.filter="Alpha(Opacity=30);";
	document.getElementById("bgDiv").style.left="0";
	document.getElementById("bgDiv").style.width=sWidth + "px";
	document.getElementById("bgDiv").style.height=sHeight + "px";
	document.getElementById("bgDiv").style.zIndex = "10000";
    //显示层
    document.getElementById("massage_box").style.left = (document.body.clientWidth - w) / 2+"px";
    document.getElementById("massage_box").style.top = (screen.height - h) / 2-80+"px";
    document.getElementById("massage_box").style.screenx = (document.body.clientWidth - w) / 2+"px";//仅适用于Netscape
    document.getElementById("massage_box").style.screeny = (screen.height - h) / 2-80+"px";//仅适用于Netscape
    document.getElementById("massage_box").style.width = w+"px";
    document.getElementById("massage_box").style.height = h+"px";
    document.getElementById("massage_box").className = "massage_box";
	var popiframe;
	popiframe = '<div style="border-width:1 1 3 1; width:100%; height:100%; background:#fff; color:#666666; font-size:12px;zIndex:1000">'
	popiframe += '<div onmousedown=MDown(massage_box) style="background:#666666; height:20px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px;color:#fff;cursor:move;padding:0 0 4px 0">'
	popiframe += '<div style="display:inline; width:200px; position:absolute;padding:3px 0 0 5px;color:#ffffff" id=pop_title>'+tit+'</div>'
	popiframe += '<span onClick="closeWithIframe()" style="float:right; display:inline; cursor:pointer;padding:3px 5px 0 0;font-size:12px;color:#ffffff;">关闭</span>'
	popiframe += '</div>'
	popiframe += '<div style="padding:5px" ><iframe src="'+url+'" width="'+(w-11)+'px"  height="'+(h-36)+'px" frameborder=0 scrolling=no></iframe></div>'
	popiframe += '</div>'
    document.getElementById("massage_box").innerHTML=popiframe;
    document.getElementById("massage_box").style.display = "";
}
function closeWithIframe(){
    document.getElementById("massage_box").style.display="none";
    document.getElementById("bgDiv").style.display="none";
}

//浮动提示框功能 End ========================================

function InitAjax(){
var ajax=false;
try { ajax = new ActiveXObject("Msxml2.XMLHTTP"); }
catch (e) { try { ajax = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { ajax = false; } }
if (!ajax && typeof XMLHttpRequest!='undefined') { ajax = new XMLHttpRequest(); }
return ajax;}
//公用ajax
function ToAjax(url,Post){
	if (url!=""){
		var getinfo = "";
		var ajax = InitAjax();
		ajax.open("POST", url, true);
		ajax.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded; charset=utf-8");
		ajax.send(Post);
	    ajax.onreadystatechange = function(){
		  if (ajax.readyState == 4){getinfo = ajax.responseText;}
	      document.getElementById("AjaxShow").innerHTML = getinfo;
		  }
	}
}

//搜索提示框 Begin ===========================
function searchajax(key,type,installdir){
  if(key!=""){
		var getinfo = "";
		var sUrl = "Key="+escape(key);
		if(type!="")sUrl+="&Type="+escape(type);
		var ajax = InitAjax();
		ajax.open("POST", installdir+"Search/Search.Ajax.asp", true);
		ajax.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded; charset=utf-8");
		ajax.send("Action=SearchList&Key="+escape(key)+"&Type="+escape(type));
	    ajax.onreadystatechange = function(){
		  if(ajax.readyState == 4){getinfo = ajax.responseText;}
		    if(getinfo!=""){
		      document.getElementById("SearchList").style.display = "";
              document.getElementById("SearchList").innerHTML = getinfo +"<div onclick='SearchList.innerHTML=\"\";SearchList.style.display=\"none\"' style='float:right;color:blue;cursor:pointer;padding:2px 5px'>关闭</a>";
			}else{
			  document.getElementById("SearchList").innerHTML = "";
			  document.getElementById("SearchList").style.display = "none";
			}
		  }
  }else{
    document.getElementById("SearchList").innerHTML = "";
    document.getElementById("SearchList").style.display = "none";
  }
}
//搜索提示框 End ===========================

//添加信息店铺等时AJAX调用自定义选项
//t 1分类信息2店铺 sid 分类ID id 内容id
function dbajax(t,sid,id){
		var getinfo = "";
		var ajax = InitAjax();
		ajax.open("POST","../Inc/WM.DB.Ajax.asp" , true);
		ajax.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded; charset=utf-8");
		ajax.send("T="+t+"&SortID="+sid+"&ID="+id+"&F=Class");
	    ajax.onreadystatechange = function(){
		  if (ajax.readyState == 4){getinfo = ajax.responseText;}
	      document.getElementById("DBShow").innerHTML = getinfo;
		  if(getinfo!=""){document.getElementById("DBtr").style.display="";}else{document.getElementById("DBtr").style.display="none";}
		}
}
function areadbajax(sid,carea,isedit){
		var getinfo = "";
		var ajax = InitAjax();
		ajax.open("POST","../Inc/WM.DB.Ajax.asp" , true);
		ajax.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded; charset=utf-8");
		ajax.send("SortID="+sid+"&IsEdit="+isedit+"&F=Area&C="+escape(carea));
	    ajax.onreadystatechange = function(){
		  if (ajax.readyState == 4){getinfo = ajax.responseText;}
		  if (isedit==0 && carea!=""){
	        document.getElementById("ChAreaDBShow").innerHTML = getinfo;
		  }else{
	        document.getElementById("AreaDBShow").innerHTML = getinfo;
		    if(getinfo!=""){document.getElementById("AreaDBtr").style.display="";}else{document.getElementById("AreaDBtr").style.display="none";}
		  }
		}
}

//留言回复投票
function ReBallotAjax(url,w,d,n,id){
	if(url!="" && w!="" && d!="" && id!=""){
		if(n=="")n=0;
		var getinfo = "";
		var ajax = InitAjax();
		ajax.open("POST",url+"Review.asp" , true);
		ajax.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded; charset=utf-8");
		ajax.send("Action=ReBallot&W="+w+"&ID="+d);
	    ajax.onreadystatechange = function(){
		  if (ajax.readyState == 4){getinfo = ajax.responseText;
		  if(getinfo!=""){alert(getinfo)}else{document.getElementById(id).innerHTML = n+1;}
		  }
		}
	}
}

//点评投票
function ReDPAjax(url,t,n,comid,id){
	if(url!="" && t!="" && comid!="" && id!=""){
		if(n=="")n=0;
		var getinfo = "";
		var ajax = InitAjax();
		ajax.open("POST",url+"Company/Review.asp" , true);
		ajax.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded; charset=utf-8");
		ajax.send("Action=Go&W="+t+"&ID="+comid+"&DPID="+id);
	    ajax.onreadystatechange = function(){
		  if (ajax.readyState == 4){getinfo = ajax.responseText;
		  if(getinfo!=""){alert(getinfo)}else{document.getElementById("DP_"+comid+"_"+id+"_"+t).innerHTML = n+1;}
		  }
		}
	}
}

//文章投票
function ArtBallotAjax(url,post,id){
	if(url!="" && post!=""){
		var getinfo = "";
		var ajax = InitAjax();
		ajax.open("POST",url , true);
		ajax.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded; charset=utf-8");
		ajax.send(post);
	    ajax.onreadystatechange = function(){
		  if (ajax.readyState == 4){getinfo = ajax.responseText;
		  if(getinfo!=""){alert(getinfo)}else{location.reload()}
		  }
		}
	}
}

//全站回复
//0 刷新 NewRe 1刷新本页
ckreview=0;
function Clreview(){
  if(ckreview > 0){
    alert('请求已经发出，请等待片刻！\n\n'+'不要重复提交，谢谢！');
	return false;
  }
  return true;
}
function reviewajax(url,i){
  if(Clreview()){
     ckreview=1;
     var ChannelID = document.reform.ChannelID.value;
     var ID = document.reform.ID.value;
     var Content = document.reform.Content.value;
	 var ContentRe = document.reform.ContentRe.value;
     var Code = document.reform.Code.value;
     var Anonymity = "";
	 if(document.reform.Anonymity.checked){Anonymity = "True"}
     var getinfo = "";
	 var ajax = InitAjax();
     ajax.open("POST",url, true);
     ajax.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded; charset=utf-8");
     ajax.send("Action=ReviewSave&ID="+ID+"&ChannelID="+ChannelID+"&Content="+escape(Content)+"&ContentRe="+escape(ContentRe)+"&Code="+escape(Code)+"&Anonymity="+Anonymity);
     ajax.onreadystatechange = function(){
       if (ajax.readyState == 4){getinfo = ajax.responseText;
	     if(getinfo!=""){get_Code();ckreview=0;alert(getinfo)}else{get_Code();alert("发送成功");ckreview=0;
		   if(i==0){NewRe.location.reload();}else{location.href="?ID="+ID;}
		 }
		 document.reform.Content.value = "";
		 document.reform.Code.value = "";
	   }
     }
  }
  return false;
}
//全站回复 end

//搜索页竞价排名列表
function toyiajax(key,dir,t,cid,aid){
  if (t!="" && dir!=""){
		var getinfo = "";
		var ajax = InitAjax();
		ajax.open("POST",dir+"Search/Search.Ajax.asp" , true);
		ajax.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded; charset=utf-8");
		ajax.send("Action=SearchJingjia&Key="+escape(key)+"&Type="+t+"&ClassID="+cid+"&AreaID="+aid);
	    ajax.onreadystatechange = function(){
		  if (ajax.readyState == 4){getinfo = ajax.responseText;
		  if(getinfo!=""){document.getElementById("JingjiaAjaxList").innerHTML = getinfo;}else{document.getElementById("JingjiaAjaxList").innerHTML = "";}
		  }
		}
  }
}
var searchid=0;
function searchsort(s,n,obj){
  document.searchform.Type.value=n;  
  document.searchform.ChannelID.value=s;  
  document.getElementById("searchtit").innerHTML =obj.innerHTML;
  searchsort_c();
}
function searchsort_o(){
  if(document.getElementById("SearchSort").style.display == "none"){
    document.getElementById("SearchSort").style.display = "";
	searchid=1;
  }else{
    document.getElementById("SearchSort").style.display = "none";
	searchid=0;
  }
}
function searchsort_c(){
  searchid=0;
  document.getElementById("SearchSort").style.display = "none";
}

document.onclick=function(){
//  document.getElementById("SearchList").innerHTML = "";
//  document.getElementById("SearchList").style.display = "none";
}

// -->